home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-20 | 2.5 KB | 61 lines | [TEXT/MPS ] |
- A brief description of the "Scanning Generic LaserWriter" code.
-
- Messages overridden:
-
- Overrides for our custom scanning support
- -----------------------------------------
- gxPostScriptScanPrinterText - Override to pre-scan text returned by GXGetPrinterText.
- gxPostScriptScanStatusText - Override to pre-scan text returned by GXGetStatusText.
- gxOpenConnection - Override to store class/instance context data.
- gxCleanupOpenConnection - Override to remove class/instance context data.
- gxCloseConnection - Override to remove class/instance context data.
-
-
- What this code does:
- --------------------
- This PS driver has code to completely handle processing of GX's
- 'scan' resources. This means that you can intercept and post
- warnings that the default behavior doesn't know about. For
- example "Magenta ink is low," "The printer needs attention,"
- etc. To handle this, both gxPostScriptScanPrinterText and
- gxPostScriptScanStatusText are overridden. These overrides
- will be either total or partial depending on what happens when
- we "pre-process" the text to be scanned. If we post an alert
- or write to the desktop printer window, we don't forward the
- message to GX's default implementation. If we did so, it might
- clear our messages. However, if we simply munge the text we're
- passed, and don't post a message, then we forward the text to
- GX's default scanning code for secondary processing.
-
-
- Interesting tricks and tidbits:
- -------------------------------
- Because it's important to know what the current alert state is,
- we save this information in our context instance. That way, we
- can easily see what the last status we processed was. We also
- store the two pre-scan 'scan' handles in our class context. This
- way, no matter how many instanciations of our driver are active
- at once, (e.g. if multiple desktop printers are printing), the
- 'scan' handles will only be loaded into memory once.
-
- The process this code goes through is quite simple:
-
- while (there are more 'scan' entries)
- {
- Parse a scan entry.
- Apply it to the text we're scanning, using Munger.
- Hold on to the most urgent alert (if any) that
- should be posted as a result of matches between
- 'scan' entries and the text we're looking at.
- }
-
- If (the most urgent alert condition we found was "Normal status")
- Clear any alert condition that we posted.
- else
- If (the most urgent alert condition we found was a non-fatal error)
- Post it using GXAlertTheUser.
- else
- If (the most urgent alert condition we found was a fatal error)
- return the error.
-
- dmh 7/4/94